import mongoose from '../dbHelper'
import { defaultSchemaExtend, defaultSchemaOptions } from '../config/index'

const Schema = mongoose.Schema

const dlyadminOrderStinetsSchema = new Schema(
	Object.assign(
		{
			// 发起的用户ID
			proxyUserId: {
				type: Schema.Types.ObjectId,
				ref: 'DlyAdminUser',
			},
			binkType: {
				type: Number,
				default: 1,
			},
			userName: {
				type: String,
			},
			userNo: {
				type: String,
			},
			binkName: String,
			binkNo: String,
			userPhone: String,
			emaill: String,
			// 状态
			status: {
				type: Number,
				default: 0, // 0 发起申请 1 申请通过 2 申请拒绝
			},
			// 拒绝备注
			refuseRemark: {
				type: String,
				default: '',
			},

			// 申请金额
			applyMoney: {
				type: Number,
				default: 0,
			},
			// 打款金额
			payMoney: {
				type: Number,
				default: 0,
			},
			// 上级ID
			parentId: {
				type: Schema.Types.ObjectId,
				ref: 'DlyAdminUser',
			},
			// 申请时间
			applyTime: {
				type: Date,
				default: Date.now,
			},
			// 打款时间
			payTime: {
				type: Date,
			},
			// 打款凭证
			payImg: String,
		},
		defaultSchemaExtend
	),
	defaultSchemaOptions
)

const dlyadminOrderStinets = mongoose.model(
	'dlyadminOrderStinets',
	dlyadminOrderStinetsSchema,
	'dlyadminOrderStinetss'
)

export default dlyadminOrderStinets
